[m,n] = size(test_data);
alliid = train_data(:,2);
res = zeros(1,3);
index = 1;
for i = 1:m
    iid = test_data(i,2);
    uid = test_data(i,1);
    df = train_data(alliid==iid,:);
    foruid = df(:,1);
    a = uid;
    for u = foruid'
        if u==uid
            continue
        end
        b = u;
        if a > b
            a = u;
            b = uid;
        end
        if any((res(:,1)==a)+(res(:,2)==b)==2)
            continue
        end
        c = sim_pearson(train_data,a,b);
        res(index,:) = [a,b,c];
        index = index + 1;
    end
end